﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SQLite;

namespace TheHomeOfMiao
{
    public partial class ForgetPassword : Form
    {
        string name;
        public ForgetPassword()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            name = this.username.Text.ToString();
            using (SQLiteConnection connection = new SQLiteConnection(@"DataSource=..\..\Resources\TheHomeOfMiao1.db;Version=3"))
            {
                connection.Open();
                using (SQLiteCommand command = new SQLiteCommand("select * from user where username='" + name + "'", connection))
                {
                    SQLiteDataReader reader = command.ExecuteReader();
                    reader.Read();
                    MessageBox.Show("密码为：" + reader["password"].ToString());
                    reader.Close();
                }
                
                connection.Close();
            }
            
        }
    }
}
